package com.yc154.dao;

import com.yc.damai.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class UserDao{

    @Autowired
    JdbcTemplate jdbcTemplate;

    public User getUserById(Integer id){
        String sql="select * from user where uid=?";
        return jdbcTemplate.queryForObject(sql,
                new BeanPropertyRowMapper<User>(User.class),
                id);
    }

}
